Beginners' Guide: Changing File Ownership with `chown` in Ubuntu

`chown` is a core command in Ubuntu for modifying the owner and group of files/directories to adjust file ownership. Its syntax is `chown [options] new_owner[:new_group] file/directory`, with key parameters including: -R (recursively modify directories and sub-files), -v (display operation process), and -h (only modify the owner of symbolic links). Practical scenarios: ① Modify the owner of a single file (requires sudo, e.g., `chown -v new_user file`); ② Recursively modify a directory (`chown -R new_user directory`); ③ Modify both owner and group simultaneously (`chown new_owner:new_group file`); ④ Modify a symbolic link (`chown -h new_user link_file`). Notes: Ordinary users can only modify their own files; system files require sudo. It is recommended to confirm the directory structure before using -R recursion. Ensure the username/group name exists. `chown` can modify both owner and group at once, while `chgrp` only changes the group. By mastering basic syntax and parameters and practicing more, proficiency can be achieved.

Read More